//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#ifndef ASCIIKEY__H
#define ASCIIKEY__H

enum {
    ASCII_LeftArrow =  0xE0,
    ASCII_RightArrow = 0xE1,
    ASCII_Insert =     0xE2,
    ASCII_Delete =     0xE3,
    ASCII_Home =       0xE4,
    ASCII_End =        0xE5,
    ASCII_UpArrow =    0xE6,
    ASCII_DownArrow =  0xE7,
    ASCII_PageUp =     0xE8,
    ASCII_PageDown =   0xE9,
    ASCII_At =         0xEA,
    ASCII_Tab =        0x09,
    ASCII_BackSpace =  0x08,
    ASCII_SPACE =      0x20,
    ASCII_ENTER =      0x0D,
    ASCII_F1 =         0xBB,
    ASCII_F2 =         0xBC,
    ASCII_F3 =         0xBD,
    ASCII_F4 =         0xBE,
    ASCII_F5 =         0xBF,
    ASCII_F6 =         0xC0,
    ASCII_F7 =         0xC1,
    ASCII_F8 =         0xC2,
    ASCII_F9 =         0xC3,
    ASCII_F10 =        0xC4,
    ASCII_F11 =        0xD7,
    ASCII_F12 =        0xD8,
};

//
// CTRL, ALT, SHIFT status
//
#define KBD_CTRL                0x0001
#define KBD_ALT                 0x0002
#define KBD_SHIFT               0x0004
#define KBD_CAS                 0x0007
#define KBD_LCTRL               0x0100
#define KBD_LALT                0x0200
#define KBD_LSHIFT              0x0400
#define KBD_RCTRL               0x1000
#define KBD_RALT                0x2000
#define KBD_RSHIFT              0x4000

//
// Num Lock, Caps Lock, Scroll Lock
//
#define KBD_CAPLOCK             0x0004
#define KBD_NUMLOCK             0x0002

#define FLAG_TAB                0x1000
#define FLAG_TAB_BEGIN          0x2000
#define FLAG_TAB_END            0x4000

#define SCANCODE(key)           (key | 128)
#define ASCIICODE(key)          (key)

#define KEY_TAB                 ASCIICODE('\t')
#define KEY_NL                  ASCIICODE('\n')
#define KEY_CR                  ASCIICODE('\r')
#define KEY_ENTER               ASCIICODE('\r')
#define KEY_BS                  ASCIICODE('\b')
#define KEY_ESC                 ASCIICODE(27)
#define KEY_CTL_C               ASCIICODE(3)

#define MAXLINELENGTH  80

int TranslateVirtualcodeToASCII(uint8_t uVirtualcode, uint16_t uLedState,
         uint16_t uKeyboardState);

#endif
